build-array in combination with pick-array enables to automate building hexachords from a 2-dimensional prime-inversion array used in 12 tone composing.
In the following an array of 12x12 is defined. Each row MUST have the equal number of columns, and there should he as many rows and colums, but otherwise you can use as many elements as you want.
(setq array
(build-array
; column 0 1 2 3 4 5 6 7 8 9 10 11
'((10 5 0 11 9 6 1 3 7 8 2 4) ; row 0
(3 10 5 4 2 11 6 8 0 1 7 9) ; 1
(8 3 10 9 7 4 11 1 5 6 0 2) ; 2
(9 4 11 10 8 5 0 2 6 7 1 3) ; 3
(11 6 1 0 10 7 2 4 8 9 3 5) ; 4
(2 9 4 3 1 10 5 7 11 0 6 8) ; 5
(7 2 9 8 6 3 10 0 4 5 11 1) ; 6
(5 0 7 6 4 1 8 10 2 3 9 11) ; 7
(1 8 3 2 0 9 4 6 10 11 5 7) ; 8
(0 7 2 1 11 8 3 5 9 0 4 6) ; 9
(6 1 8 7 5 2 9 11 3 4 10 0) ; 10
(4 11 6 5 3 0 7 9 1 2 8 10)))) ; 11
To pick up hexacord use pick-array.
(pick-array 11 7 6 array :right)
--> (9 1 2 8 10 4)
Hint: When building arrays suitable in 12 tone composition you may find the following example useful.